package Method_References;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Map;
import java.util.stream.Collectors;

public class number1 {
	public static void main(String[] args) {
		ArrayList<String> arr=new ArrayList();
		Collections.addAll(arr, "张三,21", "李四,24", "丁真,26", "珍珠,27", "锐刻五,30");
		
		//保留年龄大于24岁，并加结果放到map里面，姓名为建，年龄为值
		 Map<String, Integer> resultMap = arr.stream()
		.filter(s -> Integer.parseInt(s.split(",")[1])>24)
		.collect(Collectors.toMap(s -> s.split(",")[0] , s -> Integer.parseInt(s.split(",")[1])));
		
		 System.out.println(resultMap);
	}
}
